﻿using com.yoozoo.gta.Tools.UI;
using UnityEditor;
using UnityEngine;
using UnityEngine.AssetStandardProcessors.DataModel.Version2;

namespace com.yoozoo.gta.Extension.UGUI.Editor
{
    [CustomEditor(typeof(MarginScaler), true)]
    public class MarginScalerEditor:UnityEditor.Editor
    {
        public override void OnInspectorGUI()
        {
            GUILayout.Label("MarginScaler接管RectTransform的属性，不要手动改");
            base.OnInspectorGUI();
            
            serializedObject.Update();
            var item = target as MarginScaler;
            if(GUILayout.Button("刷新"))
            {
                //给所有空的添加Adapter组件
                item.forceRefreshInEditor = true;
                item.RefreshMargin();

            }

        }
    }
}